package com.yst.common.config;

import com.aliyun.oss.OSSClient;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 用于配置OSS的连接客户端OSSClient。
 *
 * @Author 小涛
 * @Create 2019-08-16  18:04
 */
@Configuration
@ConfigurationProperties(prefix = "aliyun.oss")
@Data
public class OssConfig {
    private String endpoint;
    private String keyid;
    private String keysecret;
    private String bucketname;
    private String filehost;
    private String dir;


    @Bean
    public OSSClient ossClient() {
        return new OSSClient(endpoint, keyid, keysecret);
    }
}
